<%@	Page Language="C#" MasterPageFile="Admin.master" Title="Jeff Duty | Admin"
	CodeFile="Photos.aspx.cs" Inherits="Admin_Photos" %>

<asp:content id="Content1" contentplaceholderid="Main" runat="server">

	<div class="shim column"></div>
	
	<div class="page" id="admin-photos">

		<div align="center">
			<h3>
                Manage Photos</h3>
            <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="1">
                <asp:View ID="View1" runat="server">
			<asp:FormView ID="FormView1" Runat="server" 
				DataSourceID="ObjectDataSource1" DefaultMode="insert"
				BorderWidth="0px" CellPadding="0" OnItemInserting="FormView1_ItemInserting" OnItemInserted="FormView1_ItemInserted">
				<InsertItemTemplate>
                    <table border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td align="left" colspan=2>
					<asp:RequiredFieldValidator	ID="RequiredFieldValidator1" Runat="server" ErrorMessage="You must choose a caption." ControlToValidate="PhotoFile" Display="Dynamic" Enabled="false" Width="415px" />
					<p>
						Photo<br />
						<asp:FileUpload ID="PhotoFile" Runat="server" Width="416" FileBytes='<%# Bind("BytesOriginal") %>' CssClass="textfield" /><br />
						Caption<br />
						<asp:TextBox ID="PhotoCaption" Runat="server" Width="326" Text='<%# Bind("Caption") %>' CssClass="textfield" /><br />
                        Description<br />
                        <asp:TextBox ID="TextBox1" runat="server" Height="152px" Text='<%# Bind("Description") %>'
                            TextMode="MultiLine" Width="326px"></asp:TextBox></p>
                            </td>
                        </tr>
                        <tr>
                            <td align="left">
                                <asp:ImageButton ID="ibuCancle" runat="server" OnClick="ibuCancle_Click" SkinID="cancel" /></td>
                            <td align="right">
                            <asp:ImageButton ID="AddNewPhotoButton" Runat="server" CommandName="Insert" skinid="add"/></td>
                        </tr>
                    </table>
					<p style="text-align:right;">
                        &nbsp;
					</p>
				</InsertItemTemplate>
			</asp:FormView>
                </asp:View>
                <asp:View ID="View2" runat="server">
                    <h4>
                    Photos in This Album</h4>
                    <p>
                        <table border="0" cellpadding="0" cellspacing="0" style="width: 599px">
                            <tr>
                                <td style="width: 100px" align="center" valign="top">
                Add a single image to the album<br />
                                    <asp:ImageButton ID="ibuChanview" runat="server" OnClick="ibuChanview_Click" SkinID="add" />
                                </td>
                                <td style="width: 100px" align="center" valign="top">
                                    Bulk Upload images from the upload folder<br />
                                    <asp:ImageButton ID="imgBulk" runat="server" OnClick="imgBulk_Click" SkinID="add" /></td>
                            </tr>
                            <tr>
                                <td colspan="2" style="width: 100px; height: 16px" align="center" valign="top">
                                    The following are the photos	currently in this album.</td>
                            </tr>
                        </table>
		</p>
                    <p>
			<asp:gridview id="GridView1" runat="server" datasourceid="ObjectDataSource1" 
				datakeynames="PhotoID" cellpadding="6" EnableViewState="False"
				autogeneratecolumns="False" BorderStyle="None" BorderWidth="0px" width="420px" showheader="False" AllowPaging="True" >
				<EmptyDataRowStyle CssClass="emptydata"></EmptyDataRowStyle>
				<EmptyDataTemplate>
					You currently have no photos.
				</EmptyDataTemplate>
				<columns>
					<asp:TemplateField>
						<ItemStyle Width="50px" />
						<ItemTemplate>
							<table border="0" cellpadding="0" cellspacing="0" class="photo-frame">
								<tr>
									<td class="topx--"></td>
									<td class="top-x-"></td>
									<td class="top--x"></td>
								</tr>
								<tr>
									<td class="midx--"></td>
									<td><a href='Details.aspx?AlbumID=<%# Eval("AlbumID") %>&Page=<%# ((GridViewRow)Container).RowIndex %>'>
										<img src='../Handler.ashx?Size=S&PhotoID=<%# Eval("PhotoID") %>' class="photo_198" style="border:2px solid white;width:50px;" alt='Thumbnail of Photo Number <%# Eval("PhotoID") %>' /></a></td>
									<td class="mid--x"></td>
								</tr>
								<tr>
									<td class="botx--"></td>
									<td class="bot-x-"></td>
									<td class="bot--x"></td>
								</tr>
							</table>
						</ItemTemplate>
					</asp:TemplateField>
                    <asp:TemplateField HeaderText="Caption">
                        <EditItemTemplate>
                            Caption<br />
                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Caption") %>'></asp:TextBox>
                            <br /><br />
                            Description
                            <br />
                            <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Description") %>' Height="143px" TextMode="MultiLine" Width="315px"></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <b><u>Caption</u></b><br />
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("Caption") %>'></asp:Label> 
                            <br /><br />
                            <b><u>Description</u></b>
                            <br /><asp:Label ID="Label2" runat="server" Text='<%# Bind("Description") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
						<ItemStyle Width="150px" />
						<ItemTemplate>
							<div style="width:100%;text-align:right;">
								<asp:ImageButton ID="ImageButton2" Runat="server" CommandName="Edit" SkinID="rename" />
								<asp:ImageButton ID="ImageButton3" Runat="server" CommandName="Delete"  SkinID="delete" />
							</div>
						</ItemTemplate>
						<EditItemTemplate>
							<div style="width:100%;text-align:right;">
								<asp:ImageButton ID="ImageButton4" Runat="server" CommandName="Update" SkinID="save" />
								<asp:ImageButton ID="ImageButton5" Runat="server" CommandName="Cancel"  SkinID="cancel" />
							</div>
						</EditItemTemplate>
					</asp:TemplateField>
				</columns>
			</asp:gridview>
                    </p>
                </asp:View>
            </asp:MultiView>&nbsp;
			<hr />
			<h4>
                &nbsp;</h4>
		</div>

	 </div>
	
	<asp:ObjectDataSource ID="ObjectDataSource1" Runat="server" TypeName="PhotoManager" 
		SelectMethod="GetPhotos"
		InsertMethod="AddPhoto" 
		DeleteMethod="RemovePhoto" 
		UpdateMethod="EditPhoto" >
		<SelectParameters>
			<asp:QueryStringParameter Name="AlbumID" Type="Int32" QueryStringField="AlbumID" />
		</SelectParameters>
		<InsertParameters>
			<asp:QueryStringParameter Name="AlbumID" Type="Int32" QueryStringField="AlbumID" />
		</InsertParameters>
	</asp:ObjectDataSource>
	
	<asp:ObjectDataSource ID="ObjectDataSource2" Runat="server" TypeName="PhotoManager" 
		SelectMethod="ListUploadDirectory" >
	</asp:ObjectDataSource>
	 
</asp:content>
